﻿Public Class Main

    Dim colCountry As New DataGridViewComboBoxColumn
    Dim colTankType As New DataGridViewComboBoxColumn
    Dim colTank As New DataGridViewComboBoxColumn
    Dim colCrew As New DataGridViewTextBoxColumn
    Dim colHP As New DataGridViewTextBoxColumn
    Dim colHullArmor As New DataGridViewTextBoxColumn
    Dim colWeight As New DataGridViewTextBoxColumn
    Dim colEngine As New DataGridViewTextBoxColumn
    Dim colHorsePower As New DataGridViewTextBoxColumn
    Dim colFireChance As New DataGridViewTextBoxColumn
    Dim colEngineWeight As New DataGridViewTextBoxColumn
    Dim colRadio As New DataGridViewTextBoxColumn
    Dim colRange As New DataGridViewTextBoxColumn
    Dim colRadioWeight As New DataGridViewTextBoxColumn
    Dim colTracks As New DataGridViewTextBoxColumn
    Dim colMaxLoad As New DataGridViewTextBoxColumn
    Dim colTrackTraverse As New DataGridViewTextBoxColumn
    Dim colTrackWeight As New DataGridViewTextBoxColumn
    Dim colTurret As New DataGridViewTextBoxColumn
    Dim colTurretArmor As New DataGridViewTextBoxColumn
    Dim colTurretTraverse As New DataGridViewTextBoxColumn
    Dim colTraverseArc As New DataGridViewTextBoxColumn
    Dim colViewRange As New DataGridViewTextBoxColumn
    Dim colTurretWeight As New DataGridViewTextBoxColumn
    Dim colGun As New DataGridViewTextBoxColumn
    Dim colAmmo As New DataGridViewTextBoxColumn
    Dim colDamage As New DataGridViewTextBoxColumn
    Dim colPen As New DataGridViewTextBoxColumn
    Dim colRate As New DataGridViewTextBoxColumn
    Dim colAccuracy As New DataGridViewTextBoxColumn
    Dim colAimTime As New DataGridViewTextBoxColumn
    Dim colGunWeight As New DataGridViewTextBoxColumn
    Dim gridHeight As Integer
    Dim path As String = "Changelog.txt"

    Private Sub Main_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        If System.IO.File.Exists(path) = False Then
            ChangelogWriter()
        ElseIf System.IO.File.Exists(path) = True Then
            For Each line As String In System.IO.File.ReadAllLines(path)
                If V01ToolStripMenuItem.Text > line.Trim("1.0") Then
                    ChangelogWriter()
                End If
            Next
        End If
        cboxCountry.SelectedIndex = 0
    End Sub

    Private Sub ChangelogToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ChangelogToolStripMenuItem.Click
        Try
            For Each line As String In System.IO.File.ReadAllLines(path)
                If V01ToolStripMenuItem.Text > line.Trim("1.0") Then
                    ChangelogWriter()
                End If
            Next
            Process.Start("Changelog.txt")
        Catch ex As Exception
            ChangelogWriter()
            Process.Start("Changelog.txt")
        End Try
    End Sub

    Private Sub ExitToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        Me.Close()
    End Sub

    Private Sub OpenSourceToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenSourceToolStripMenuItem.Click
        Process.Start("http://code.google.com/p/wot-equipment-checker/")
    End Sub

    Private Sub WoTWikiToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles WoTWikiToolStripMenuItem.Click
        Process.Start("http://wiki.worldoftanks.com/Main_Page")
    End Sub

    Private Sub ChangelogWriter()
        Dim changelog As String = "Program is in alpha. The changelog will be updated starting with release."
        Dim writer As New System.IO.StreamWriter(path, False)
        writer.Write(changelog)
        writer.Close()
    End Sub

    Private Sub cboxCountry_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cboxCountry.SelectedIndexChanged
        cboxTankType.Items.Clear()
        Select Case cboxCountry.SelectedItem
            Case "China"
                cboxTankType.Items.AddRange({"Light", "Medium", "Heavy"})
            Case "France"
                cboxTankType.Items.AddRange({"Light", "Medium", "Heavy", "TD", "SPG"})
            Case "Germany"
                cboxTankType.Items.AddRange({"Light", "Medium", "Heavy", "TD", "SPG"})
            Case "U.K."
                cboxTankType.Items.AddRange({"Light", "Medium", "Heavy"})
            Case "U.S.A."
                cboxTankType.Items.AddRange({"Light", "Medium", "Heavy", "TD", "SPG"})
            Case "U.S.S.R."
                cboxTankType.Items.AddRange({"Light", "Medium", "Heavy", "TD", "SPG"})
        End Select
        cboxTankType.SelectedIndex = 0
    End Sub

    Private Sub cboxTankType_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cboxTankType.SelectedIndexChanged
        cboxTank.Items.Clear()
        Select Case cboxTankType.SelectedItem
            Case "Light"
            	Select Case cboxCountry.SelectedItem
            		Case "China"
            			cboxTank.Items.AddRange({"Renault NC-31", "Vickers Mk. E Type B", "Type 2597 Chi-Ha", "M5A1 Stuart", "59-16", "Type 62", "WZ-131"})
            			cboxTank.SelectedIndex = 0
                    Case "France"
                        cboxTank.Items.AddRange({"RenaultFT", "D1", "Hotchkiss H35", "AMX 38", "AMX 40", "ELC AMX", "AMX 12t", "AMX 13 75", "AMX 13 90"})
                        cboxTank.SelectedIndex = 0
                    Case "Germany"
                        cboxTank.Items.AddRange({"Leichttraktor", "PzKpfw 35 (t)", "PzKpfw 38H735 (f)", "PzKpfw II", "PzKpfw 38 (t)", "PzKpfw II Ausf. J", "PzKpfw II Luchs", "PzKpfw III Ausf. A", "T-15", "PzKpfw 38 nA", "VK 1602 Leopard", "VK 2801"})
                        cboxTank.SelectedIndex = 0
                    Case "U.K."
                        cboxTank.Items.AddRange({"Cruiser Mk. I", "Cruiser Mk. III", "Cruiser Mk. II", "Cruiser Mk. IV", "Covenanter", "Valentine", "Crusader"})
                        cboxTank.SelectedIndex = 0
                    Case "U.S.A."
                        cboxTank.Items.AddRange({"T1 Cunningham", "M2 LT", "T1E6", "T2 LT", "M22 Locust", "M3 Stuart", "MTLS-1G14", "M5 Stuart", "M24 Chaffee", "T21", "T71"})
                        cboxTank.SelectedIndex = 0
                    Case "U.S.S.R."
                        cboxTank.Items.AddRange({"MS-1", "BT-2", "Tetrarch", "T-26", "BT-7", "BT-SV", "M3 Stuart Lend Lease", "T-127", "T-46", "A-20", "T-50", "Valentine II", "T-50-2"})
                        cboxTank.SelectedIndex = 0
                End Select
            Case "Medium"
            	Select Case cboxCountry.SelectedItem
            		Case "China"
            			cboxTank.Items.AddRange({"Type T-34", "Type 58", "T-34-1", "T-34-2", "Type 59", "Type 59 G", "WZ-120", "121"})
            			cboxTank.SelectedIndex = 0
                    Case "France"
                        cboxTank.Items.AddRange({"D2", "Lorraine 40 t", "Bat Chatillon 25 t"})
                        cboxTank.SelectedIndex = 0
                    Case "Germany"
                        cboxTank.Items.AddRange({"PzKpfw S35 739 (f)", "PzKpfw III", "PzKpfw III/IV", "PzKpfw IV", "PzKpfw IV Hydraulic", "T-25", "PzKpfw IV Schmalturm", "PzKpfw V-IV", "PzKpfw V-IV Alpha", "VK 3001 (H)", "VK 3001 (P)", "VK 3601 (H)", "Panther PzV/M10", "PzKpfw V Panther", "VK 3002 (DB)", "Panther II", "E-50", "E-50 Ausf. M"})
                        cboxTank.SelectedIndex = 0
                    Case "U.K."
                        cboxTank.Items.AddRange({"Medium Mk. I", "Medium Mk. II", "Medium Mk. III", "Matilda", "Matilda Black Prince", "Cromwell", "Comet", "Centurion Mk. I", "Centurion Mk. 7/1", "FV4202"})
                        cboxTank.SelectedIndex = 0
                    Case "U.S.A."
                        cboxTank.Items.AddRange({"T2 MT", "M2 MT", "M3 Lee", "M4 Sherman", "M4A2E4", "M7 MT", "Ram-II", "M4A3E2", "M4A3E8", "T20", "M26 Pershing", "T26E4 Super Pershing", "T69", "M46 Patton", "T54E1", "T54E1", "M48A1"})
                        cboxTank.SelectedIndex = 0
                    Case "U.S.S.R."
                        cboxTank.Items.AddRange({"A-32", "T-28", "Matilda IV", "T-34", "T-34-85", "KV-13", "T-43", "T-44", "T-54", "T-62A"})
                        cboxTank.SelectedIndex = 0
                End Select
            Case "Heavy"
            	Select Case cboxCountry.SelectedItem
            		Case "China"
            			cboxTank.Items.AddRange({"IS-2", "110", "WZ-111", "WZ-111 model 1-4", "113"})
            			cboxTank.SelectedIndex = 0
                    Case "France"
                        cboxTank.Items.AddRange({"B1", "BDR G1B", "ARL 44", "AMX M4(1945)", "AMX 50 100", "FCM 50 t", "AMX 50 120", "AMX 50B"})
                        cboxTank.SelectedIndex = 0
                    Case "Germany"
                        cboxTank.Items.AddRange({"PzKpfw B2 740 (f)", "PzKpfw VI Tiger", "PzKpfw Tiger (P)", "Lowe", "PzKpfw VIB Tiger II", "VK 4502 (P) Ausf. A", "E-75", "VK 4502 (P) Ausf. B", "E-100", "Maus"})
                        cboxTank.SelectedIndex = 0
                    Case "U.K."
                        cboxTank.Items.AddRange({"Churchill I", "Churchill VII", "TOG II", "Black Prince", "Caernarvon", "Conqueror", "FV215b"})
                        cboxTank.SelectedIndex = 0
                    Case "U.S.A."
                        cboxTank.Items.AddRange({"T1 HT", "T14", "M6", "T29", "M6A2E1", "T32", "T34", "M103", "T110E5", "T57 HT"})
                        cboxTank.SelectedIndex = 0
                    Case "U.S.S.R."
                        cboxTank.Items.AddRange({"Churchill III", "KV-1", "KV-220", "KV-220 Beta-Test", "KV-1S", "KV-2", "T-150", "IS", "KV-3", "IS-3", "IS-6", "KV-4", "KV-5", "IS-8", "ST-1", "IS-4", "IS-7"})
                        cboxTank.SelectedIndex = 0
                End Select
            Case "TD"
                Select Case cboxCountry.SelectedItem
                    Case "France"
                        cboxTank.Items.AddRange({"RenaultFT AC", "FCM36 PaK40", "Renault UE 57", "Somua SAu-40", "S-35 CA", "ARL V39", "AMX AC Mle. 1946", "AMX AC Mle. 1948", "AMX 50 Foch", "AMX-50 Foch (155)"})
                        cboxTank.SelectedIndex = 0
                    Case "Germany"
                        cboxTank.Items.AddRange({"Panzerjager I", "Marder II", "Hetzer", "StuG III", "Dicker Max", "JagdPz IV", "Jagdpanther", "8.8 cm PaK 43 Jagdtiger", "Ferdinand", "Jagdpanther II", "Jagdtiger", "JagdPz E-100"})
                        cboxTank.SelectedIndex = 0
                    Case "U.K."
                    	cboxTank.Items.Add("AT-15A")
                    	cboxTank.SelectedIndex = 0
                    Case "U.S.A."
                        cboxTank.Items.AddRange({"T18", "T82", "M8A1", "T40", "M10 Wolverine", "T49", "M18 Hellcat", "M36 Jackson", "T25 AT", "T25/2", "T28", "T28 Prototype", "T30", "T95", "T110E3", "T110E4"})
                        cboxTank.SelectedIndex = 0
                    Case "U.S.S.R."
                        cboxTank.Items.AddRange({"AT-1", "SU-76", "SU-85B", "SU-85", "SU-85I", "SU-100", "SU-100M1", "SU-122-44", "SU-152", "ISU-152", "SU-101", "Object 704", "SU-122-54", "Object 263", "Object 268"})
                        cboxTank.SelectedIndex = 0
                End Select
            Case "SPG"
                Select Case cboxCountry.SelectedItem
                    Case "France"
                        cboxTank.Items.AddRange({"RenaultBS", "Lorrain39 L AM", "105 leFH18B2", "AMX 105AM", "AMX 13 F3 AM", "Lorraine155 50", "Lorraine155 51", "Bat Chatillon 155"})
                        cboxTank.SelectedIndex = 0
                    Case "Germany"
                        cboxTank.Items.AddRange({"Sturmpanzer I Bison", "Sturmpanzer II", "Wespe", "Grille", "Hummel", "GW Panther", "GW Tiger", "GW Typ E"})
                        cboxTank.SelectedIndex = 0
                    Case "U.S.A."
                        cboxTank.Items.AddRange({"T57", "M37", "M7 Priest", "M41", "M12", "M40/M43", "T92"})
                        cboxTank.SelectedIndex = 0
                    Case "U.S.S.R."
                        cboxTank.Items.AddRange({"SU-18", "SU-26", "SU-5", "SU-8", "S-51", "SU-14", "Object 212", "Object 261"})
                        cboxTank.SelectedIndex = 0
                End Select
        End Select
    End Sub

    Private Sub cboxTank_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cboxTank.SelectedIndexChanged
        If dgvTank.ColumnCount = 0 Then
            With colCrew
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Crew"
                .Name = "Crew"
            End With
            With colHP
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Hit Points (HP)"
                .Name = "HP"
            End With
            With colHullArmor
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Hull Armor (front/side/rear mm)"
                .Name = "HullArmor"
            End With
            With colWeight
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Weight (t)"
                .Name = "Weight"
            End With

            dgvTank.Columns.Insert(0, colCrew)
            dgvTank.Columns.Insert(1, colHP)
            dgvTank.Columns.Insert(2, colHullArmor)
            dgvTank.Columns.Insert(3, colWeight)
        End If

        If dgvEngine.ColumnCount = 0 Then
            With colEngine
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Engine Model"
                .Name = "Engine"
            End With
            With colHorsePower
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Horse Power"
                .Name = "HorsePower"
            End With
            With colFireChance
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Fire Chance"
                .Name = "FireChance"
            End With
            With colEngineWeight
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Engine Weight (t)"
                .Name = "EngineWeight"
            End With

            dgvEngine.Columns.Insert(0, colEngine)
            dgvEngine.Columns.Insert(1, colHorsePower)
            dgvEngine.Columns.Insert(2, colFireChance)
            dgvEngine.Columns.Insert(3, colEngineWeight)
        End If

        If dgvRadio.ColumnCount = 0 Then
            With colRadio
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Radio Model"
                .Name = "Radio"
            End With
            With colRange
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Radio Range (m)"
                .Name = "Range"
            End With
            With colRadioWeight
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Radio Weight (t)"
                .Name = "RadioWeight"
            End With

            dgvRadio.Columns.Insert(0, colRadio)
            dgvRadio.Columns.Insert(1, colRange)
            dgvRadio.Columns.Insert(2, colRadioWeight)
        End If

        If dgvTracks.ColumnCount = 0 Then
            With colTracks
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Track Model"
                .Name = "Tracks"
            End With
            With colMaxLoad
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Load Limit (t)"
                .Name = "MaxLoad"
            End With
            With colTrackTraverse
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Traverse Speed (d/s)"
                .Name = "TrackTraverse"
            End With
            With colTrackWeight
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Track Weight (t)"
                .Name = "TrackWeight"
            End With

            dgvTracks.Columns.Insert(0, colTracks)
            dgvTracks.Columns.Insert(1, colMaxLoad)
            dgvTracks.Columns.Insert(2, colTrackTraverse)
            dgvTracks.Columns.Insert(3, colTrackWeight)
        End If

        If dgvTurret.ColumnCount = 0 Then
            With colTurret
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Turret Model"
                .Name = "Turret"
            End With
            With colTurretArmor
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Turret Armor (mm)"
                .Name = "TurretArmor"
            End With
            With colTurretTraverse
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Traverse Speed (d/s)"
                .Name = "TurretTraverse"
            End With
            With colTraverseArc
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Traverse Arc(d)"
                .Name = "TraverseArc"
            End With
            With colViewRange
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "View Range (m)"
                .Name = "ViewRange"
            End With
            With colTurretWeight
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Turret Weight (t)"
                .Name = "TurretWeight"
            End With

            dgvTurret.Columns.Insert(0, colTurret)
            dgvTurret.Columns.Insert(1, colTurretArmor)
            dgvTurret.Columns.Insert(2, colTurretTraverse)
            dgvTurret.Columns.Insert(3, colTraverseArc)
            dgvTurret.Columns.Insert(4, colViewRange)
            dgvTurret.Columns.Insert(5, colTurretWeight)
        End If

        If dgvGun.ColumnCount = 0 Then
            With colGun
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Gun Model"
                .Name = "Gun"
            End With
            With colAmmo
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Ammo Capacity"
                .Name = "Ammo"
            End With
            With colDamage
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Damage (AP/Gold/HE HP)"
                .Name = "Damage"
            End With
            With colPen
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Penetration (AP/Gold/HE mm)"
                .Name = "Pen"
            End With
            With colRate
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Rate of Fire"
                .Name = "FireRate (r/m)"
            End With
            With colAccuracy
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Accuracy (m)"
                .Name = "Accuracy"
            End With
            With colAimTime
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Aim Time (s)"
                .Name = "AimTime"
            End With
            With colGunWeight
                .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
                .HeaderText = "Gun Weight (t)"
            End With

            dgvGun.Columns.Insert(0, colGun)
            dgvGun.Columns.Insert(1, colAmmo)
            dgvGun.Columns.Insert(2, colDamage)
            dgvGun.Columns.Insert(3, colPen)
            dgvGun.Columns.Insert(4, colRate)
            dgvGun.Columns.Insert(5, colAccuracy)
            dgvGun.Columns.Insert(6, colAimTime)
            dgvGun.Columns.Insert(7, colGunWeight)
        End If
        
        dgvTank.Rows.Clear()
        dgvEngine.Rows.Clear()
        dgvRadio.Rows.Clear()
        dgvTracks.Rows.Clear()
        dgvTurret.Rows.Clear()
        dgvGun.Rows.Clear()

		If cboxTank.SelectedItem = "Renault NC-31" Then
			dgvTank.Rows.Add("Commander (Gunner, Radio Operator, Loader), Driver", 100, "16/16/16", 6.47)
			dgvEngine.Rows.Add("Renault M26/27", 45, 20, 0.266)
			dgvEngine.Rows.Add("Renault 62CV", 62, 20, 0.266)
			dgvEngine.Rows.Add("Renault NC-2", 75, 20, 0.266)
			dgvRadio.Rows.Add("Signal Flags", 90, 0.001)
			dgvRadio.Rows.Add("ER 52", 300, 0.1)
			dgvTracks.Rows.Add("M24/25", 6.6, 36, 0.8)
			dgvTracks.Rows.Add("M26/27", 8.6, 38, 0.8)
			dgvTurret.Rows.Add("FT-17", "16/16/14", 38, 360, 250, 0.17)
			dgvTurret.Rows.Add("FT-18", "22/22/16", 34, 360, 280, 0.2)
			dgvGun.Rows.Add("37 mm APX SA18", 237, "30/30/36", "29/46/18", 24, 0.54, 2, 0.11)
			dgvGun.Rows.Add("13.2 mm Hothckiss mle. 1930", 720, "8/8", "23/36", 136.36, 0.58, 2, 0.038)
			dgvGun.Rows.Add("37 mm KwK 36 L/46.5", 150, "36/36/42", "40/74/18", 26.09, 0.46, 2, 0.1)
		ElseIf cboxTank.SelectedItem = "Type 62" Then		
			dgvTank.Rows.Add("Commander, Driver, Gunner, Loader (Radio Operator)", 880, "35/20/20", 21)
            dgvEngine.Rows.Add("12150L-3", 430, "12%", 0.7)
            dgvRadio.Rows.Add("A-220", 600, 0.1)
            dgvTracks.Rows.Add("Type 62 A", 24, 54, 7.7)
            dgvTurret.Rows.Add("Type 62 B", "45/35/20", 48, 360, 390, 5)
            dgvGun.Rows.Add("Type 62-85TS", 47, "180/180/300", "145/250/43", 10.53, 0.37, 2.3, 1.5)
		ElseIf cboxTank.SelectedItem = "Type 59" Then
			dgvTank.Rows.Add("Commander, Driver, Gunner, Loader (Radio Operator)", 1300, "100/60/45", 36)
        	dgvEngine.Rows.Add("NORINCO 12150L7", 520, "12%", 0.7)
        	dgvRadio.Rows.Add("9RM", 600, .1)
        	dgvTracks.Rows.Add("Type59 A", 39.8, 46, 7.7)
        	dgvTurret.Rows.Add("Type59 B", "300/130/60", 46, 360, 380, 8.5)
        	dgvGun.Rows.Add("100 mm Type 59", 34, "250/250/330", "181/241/50", 6.9, 0.39, 2.9, 2.257)
        End If

		dgvTank.Height = 44

        dgvEngine.Top = dgvTank.Location.Y + dgvTank.Height + 3
        Dim engineGrid As Integer = 0
        For x = 0 To dgvEngine.Rows.Count - 1
        	engineGrid = engineGrid + dgvEngine.RowTemplate.Height
        Next
        dgvEngine.Height = dgvEngine.ColumnHeadersHeight + engineGrid + 2
                
        dgvRadio.Top = dgvEngine.Location.Y + dgvEngine.Height + 3
        Dim radioGrid As Integer = 0
        For x = 0 To dgvRadio.Rows.Count - 1
        	radioGrid = radioGrid + dgvRadio.RowTemplate.Height
        Next
        dgvRadio.Height = dgvRadio.ColumnHeadersHeight + radioGrid + 2

        dgvTracks.Top = dgvRadio.Location.Y + dgvRadio.Height + 3
        Dim tracksGrid As Integer = 0
        For x = 0 To dgvTracks.Rows.Count - 1
        	tracksGrid = tracksGrid + dgvTracks.RowTemplate.Height
        Next
        dgvTracks.Height = dgvTracks.ColumnHeadersHeight + tracksGrid + 2
        
        dgvTurret.Top = dgvTracks.Location.Y + dgvTracks.Height + 3
        Dim turretGrid As Integer = 0
        For x = 0 To dgvTurret.Rows.Count - 1
        	turretGrid = turretGrid + dgvTurret.RowTemplate.Height
        Next
        dgvTurret.Height = dgvTurret.ColumnHeadersHeight + turretGrid + 2

		dgvGun.Top = dgvTurret.Location.Y + dgvTurret.Height + 3
        Dim gunGrid As Integer = 0
        For x = 0 To dgvGun.Rows.Count - 1
        	gunGrid = gunGrid + dgvGun.RowTemplate.Height
        Next
        dgvGun.Height = dgvGun.ColumnHeadersHeight + gunGrid + 19
    End Sub

End Class
